home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / MoviesFormat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-22  |  15.9 KB  |  648 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        MoviesFormat.h
  3.  
  4.      Contains:    QuickTime interfaces
  5.  
  6.      Version:    Technology:    Technology:    QuickTime 2.5
  7.                  Package:    Universal Interfaces 2.1.4
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __MOVIESFORMAT__
  19. #define __MOVIESFORMAT__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __WINDOWS__
  25. #include <Windows.h>
  26. #endif
  27. #ifndef __IMAGECOMPRESSION__
  28. #include <ImageCompression.h>
  29. #endif
  30. #ifndef __MOVIES__
  31. #include <Movies.h>
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT_SUPPORTED
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_ALIGN_SUPPORTED
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46.  
  47. enum {
  48.     kMovieVersion                = 0                                /* version number of the format here described */
  49. };
  50.  
  51. /*
  52. ***************************************
  53. *
  54. *   General Types -
  55. *        These types are used in more than one of the
  56. *        directory types.
  57. *
  58. ***************************************
  59. */
  60. struct MoviesUserData {
  61.     long                             size;                        /* size of this user data */
  62.     long                             udType;                        /* type of user data */
  63.     char                             data[1];                    /* the user data */
  64. };
  65. typedef struct MoviesUserData MoviesUserData;
  66.  
  67. struct UserDataAtom {
  68.     long                             size;
  69.     long                             atomType;
  70.     MoviesUserData                     userData[1];
  71. };
  72. typedef struct UserDataAtom UserDataAtom;
  73.  
  74. /*
  75.  MoviesDataDescription tells us where the data for the movie or track lives.
  76.    The data can follow the directory, be in the datafork of the same file as the directory resource,
  77.    be in the resource fork of the same file as the directory resource, be in another file in the
  78.    data fork or resource fork, or require a specific bottleneck to fetch the data. 
  79. */
  80. /*
  81. ***************************************
  82. *
  83. *   MediaDirectory information -
  84. *        The MediaDirectory is tightly coupled to the data.
  85. *
  86. ***************************************
  87. */
  88. struct SampleDescriptionAtom {
  89.     long                             size;
  90.     long                             atomType;                    /* = 'stsd' */
  91.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  92.     long                             numEntries;
  93.     SampleDescription                 sampleDescTable[1];
  94. };
  95. typedef struct SampleDescriptionAtom SampleDescriptionAtom;
  96.  
  97. /* TimeToSampleNum maps physical sample time to physical sample number. */
  98. struct TimeToSampleNum {
  99.     long                             sampleCount;
  100.     TimeValue                         sampleDuration;
  101. };
  102. typedef struct TimeToSampleNum TimeToSampleNum;
  103.  
  104. struct TimeToSampleNumAtom {
  105.     long                             size;
  106.     long                             atomType;                    /* = 'stts' */
  107.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  108.     long                             numEntries;
  109.     TimeToSampleNum                 timeToSampleNumTable[1];
  110. };
  111. typedef struct TimeToSampleNumAtom TimeToSampleNumAtom;
  112.  
  113. /* SyncSamples is a list of the physical samples which are self contained. */
  114. struct SyncSampleAtom {
  115.     long                             size;
  116.     long                             atomType;                    /* = 'stss' */
  117.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  118.     long                             numEntries;
  119.     long                             syncSampleTable[1];
  120. };
  121. typedef struct SyncSampleAtom SyncSampleAtom;
  122.  
  123. /* SampleToChunk maps physical sample number to chunk number. */
  124. /* same as SampleToChunk, but redundant first sample is removed */
  125. struct SampleToChunk {
  126.     long                             firstChunk;
  127.     long                             samplesPerChunk;
  128.     long                             sampleDescriptionID;
  129. };
  130. typedef struct SampleToChunk SampleToChunk;
  131.  
  132. struct SampleToChunkAtom {
  133.     long                             size;
  134.     long                             atomType;                    /* = 'stsc' */
  135.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  136.     long                             numEntries;
  137.     SampleToChunk                     sampleToChunkTable[1];
  138. };
  139. typedef struct SampleToChunkAtom SampleToChunkAtom;
  140.  
  141. struct ChunkOffsetAtom {
  142.     long                             size;
  143.     long                             atomType;                    /* = 'stco' */
  144.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  145.     long                             numEntries;
  146.     long                             chunkOffsetTable[1];
  147. };
  148. typedef struct ChunkOffsetAtom ChunkOffsetAtom;
  149.  
  150. struct SampleSizeAtom {
  151.     long                             size;
  152.     long                             atomType;                    /* = 'stsz' */
  153.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  154.     long                             sampleSize;
  155.     long                             numEntries;
  156.     long                             sampleSizeTable[1];
  157. };
  158. typedef struct SampleSizeAtom SampleSizeAtom;
  159.  
  160. struct ShadowSync {
  161.     long                             fdSampleNum;
  162.     long                             syncSampleNum;
  163. };
  164. typedef struct ShadowSync ShadowSync;
  165.  
  166. struct ShadowSyncAtom {
  167.     long                             size;
  168.     long                             atomType;                    /* = 'stsz' */
  169.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  170.     long                             numEntries;
  171.     ShadowSync                         shadowSyncTable[1];
  172. };
  173. typedef struct ShadowSyncAtom ShadowSyncAtom;
  174.  
  175. struct SampleTableAtom {
  176.     long                             size;
  177.     long                             atomType;                    /* = 'stbl' */
  178.  
  179.     SampleDescriptionAtom             sampleDescription;
  180.     TimeToSampleNumAtom             timeToSampleNum;
  181.     SampleToChunkAtom                 sampleToChunk;
  182.     SyncSampleAtom                     syncSample;
  183.     SampleSizeAtom                     sampleSize;
  184.     ChunkOffsetAtom                 chunkOffset;
  185.     ShadowSyncAtom                     shadowSync;
  186. };
  187. typedef struct SampleTableAtom SampleTableAtom;
  188.  
  189. struct PublicHandlerInfo {
  190.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  191.  
  192.     long                             componentType;
  193.     long                             componentSubType;
  194.     long                             componentManufacturer;
  195.     long                             componentFlags;
  196.     long                             componentFlagsMask;
  197.     char                             componentName[1];
  198. };
  199. typedef struct PublicHandlerInfo PublicHandlerInfo;
  200.  
  201. struct HandlerAtom {
  202.     long                             size;
  203.     long                             atomType;                    /* = 'hdlr' */
  204.  
  205.     PublicHandlerInfo                 hInfo;
  206. };
  207. typedef struct HandlerAtom HandlerAtom;
  208.  
  209. /* a data reference is a private structure */
  210. typedef long DataRefAtom;
  211. struct DataInfoAtom {
  212.     long                             size;
  213.     long                             atomType;                    /* = 'dinf' */
  214.  
  215.     DataRefAtom                     dataRef;
  216. };
  217. typedef struct DataInfoAtom DataInfoAtom;
  218.  
  219. struct RgnAtom {
  220.     long                             size;
  221.     long                             atomType;
  222.  
  223.     short                             rgnSize;
  224.     Rect                             rgnBBox;
  225.     char                             data[1];
  226. };
  227. typedef struct RgnAtom RgnAtom;
  228.  
  229. struct MatteCompressedAtom {
  230.     long                             size;
  231.     long                             atomType;
  232.  
  233.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  234.  
  235.     ImageDescription                 matteImageDescription;
  236.  
  237.     char                             matteData[1];
  238. };
  239. typedef struct MatteCompressedAtom MatteCompressedAtom;
  240.  
  241. struct MatteAtom {
  242.     long                             size;
  243.     long                             atomType;
  244.  
  245.     MatteCompressedAtom             aCompressedMatte;
  246. };
  247. typedef struct MatteAtom MatteAtom;
  248.  
  249. struct ClippingAtom {
  250.     long                             size;
  251.     long                             atomType;
  252.  
  253.     RgnAtom                         aRgnClip;
  254. };
  255. typedef struct ClippingAtom ClippingAtom;
  256.  
  257. /*
  258. **********************
  259. * Media Info Example Structures
  260. **********************
  261. */
  262. struct VideoMediaInfoHeader {
  263.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  264.  
  265.     short                             graphicsMode;                /* for QD - transfer mode */
  266.     short                             opColorRed;                    /* opcolor for transfer mode */
  267.     short                             opColorGreen;
  268.     short                             opColorBlue;
  269. };
  270. typedef struct VideoMediaInfoHeader VideoMediaInfoHeader;
  271.  
  272. struct VideoMediaInfoHeaderAtom {
  273.     long                             size;                        /* size of Media info */
  274.     long                             atomType;                    /* = 'vmhd' */
  275.     VideoMediaInfoHeader             vmiHeader;
  276. };
  277. typedef struct VideoMediaInfoHeaderAtom VideoMediaInfoHeaderAtom;
  278.  
  279. struct VideoMediaInfo {
  280.     long                             size;                        /* size of Media info */
  281.     long                             atomType;                    /* = 'minf' */
  282.  
  283.     VideoMediaInfoHeaderAtom         header;
  284.  
  285.     HandlerAtom                     dataHandler;
  286.  
  287.     DataInfoAtom                     dataInfo;
  288.  
  289.     SampleTableAtom                 sampleTable;
  290. };
  291. typedef struct VideoMediaInfo VideoMediaInfo;
  292.  
  293. struct SoundMediaInfoHeader {
  294.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  295.  
  296.     short                             balance;
  297.     short                             rsrvd;
  298. };
  299. typedef struct SoundMediaInfoHeader SoundMediaInfoHeader;
  300.  
  301. struct SoundMediaInfoHeaderAtom {
  302.     long                             size;                        /* size of Media info */
  303.     long                             atomType;                    /* = 'vmhd' */
  304.  
  305.     SoundMediaInfoHeader             smiHeader;
  306. };
  307. typedef struct SoundMediaInfoHeaderAtom SoundMediaInfoHeaderAtom;
  308.  
  309. struct SoundMediaInfo {
  310.     long                             size;                        /* size of Media info */
  311.     long                             atomType;                    /* = 'minf' */
  312.  
  313.     SoundMediaInfoHeaderAtom         header;
  314.  
  315.     HandlerAtom                     dataHandler;
  316.  
  317.     DataRefAtom                     dataReference;
  318.  
  319.     SampleTableAtom                 sampleTable;
  320. };
  321. typedef struct SoundMediaInfo SoundMediaInfo;
  322.  
  323. /* whatever data the media handler needs goes after the atomType */
  324. struct MediaInfo {
  325.     long                             size;
  326.     long                             atomType;
  327. };
  328. typedef struct MediaInfo MediaInfo;
  329.  
  330. /*
  331. **********************
  332. * Media Directory Structures
  333. **********************
  334. */
  335. struct MediaHeader {
  336.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  337.  
  338.     long                             creationTime;                /* seconds since Jan 1904 when directory was created */
  339.     long                             modificationTime;            /* seconds since Jan 1904 when directory was appended */
  340.  
  341.     TimeValue                         timeScale;                    /* start time for Media (Media time) */
  342.     TimeValue                         duration;                    /* length of Media (Media time) */
  343.  
  344.     short                             language;
  345.     short                             quality;
  346. };
  347. typedef struct MediaHeader MediaHeader;
  348.  
  349. struct MediaHeaderAtom {
  350.     long                             size;
  351.     long                             atomType;
  352.  
  353.     MediaHeader                     header;
  354. };
  355. typedef struct MediaHeaderAtom MediaHeaderAtom;
  356.  
  357. struct MediaDirectory {
  358.     long                             size;
  359.     long                             atomType;                    /* = 'mdia' */
  360.  
  361.     MediaHeaderAtom                 mediaHeader;                /* standard Media information */
  362.  
  363.     HandlerAtom                     mediaHandler;
  364.  
  365.     MediaInfo                         mediaInfo;
  366. };
  367. typedef struct MediaDirectory MediaDirectory;
  368.  
  369. /*
  370. **********************
  371. * Track Structures
  372. **********************
  373. */
  374.  
  375. enum {
  376.     TrackEnable                    = 1 << 0,
  377.     TrackInMovie                = 1 << 1,
  378.     TrackInPreview                = 1 << 2,
  379.     TrackInPoster                = 1 << 3
  380. };
  381.  
  382. struct TrackHeader {
  383.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  384.  
  385.     long                             creationTime;                /* seconds since Jan 1904 when directory was created */
  386.     long                             modificationTime;            /* seconds since Jan 1904 when directory was appended */
  387.  
  388.     long                             trackID;
  389.  
  390.     long                             reserved1;
  391.  
  392.     TimeValue                         duration;                    /* length of track (track time) */
  393.  
  394.     long                             reserved2;
  395.     long                             reserved3;
  396.  
  397.     short                             layer;
  398.     short                             alternateGroup;
  399.  
  400.     short                             volume;
  401.     short                             reserved4;
  402.  
  403.     MatrixRecord                     matrix;
  404.     Fixed                             trackWidth;
  405.     Fixed                             trackHeight;
  406. };
  407. typedef struct TrackHeader TrackHeader;
  408.  
  409. struct TrackHeaderAtom {
  410.     long                             size;                        /* size of track header */
  411.     long                             atomType;                    /* = 'tkhd' */
  412.  
  413.     TrackHeader                     header;
  414. };
  415. typedef struct TrackHeaderAtom TrackHeaderAtom;
  416.  
  417. struct EditListType {
  418.     TimeValue                         trackDuration;
  419.     TimeValue                         mediaTime;
  420.     Fixed                             mediaRate;
  421. };
  422. typedef struct EditListType EditListType;
  423.  
  424. struct EditListAtom {
  425.     long                             size;
  426.     long                             atomType;                    /* = elst */
  427.  
  428.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  429.  
  430.     long                             numEntries;
  431.     EditListType                     editListTable[1];
  432. };
  433. typedef struct EditListAtom EditListAtom;
  434.  
  435. struct EditsAtom {
  436.     long                             size;
  437.     long                             atomType;                    /* = edts */
  438.  
  439.     EditListAtom                     editList;
  440. };
  441. typedef struct EditsAtom EditsAtom;
  442.  
  443. struct TrackLoadSettings {
  444.     TimeValue                         preloadStartTime;
  445.     TimeValue                         preloadDuration;
  446.     long                             preloadFlags;
  447.     long                             defaultHints;
  448. };
  449. typedef struct TrackLoadSettings TrackLoadSettings;
  450.  
  451. struct TrackLoadSettingsAtom {
  452.     long                             size;
  453.     long                             atomType;                    /* = load */
  454.  
  455.     TrackLoadSettings                 settings;
  456. };
  457. typedef struct TrackLoadSettingsAtom TrackLoadSettingsAtom;
  458.  
  459. struct TrackDirectory {
  460.     long                             size;
  461.     long                             atomType;                    /* = 'trak' */
  462.  
  463.     TrackHeaderAtom                 trackHeader;                /* standard track information */
  464.  
  465.     ClippingAtom                     trackClip;
  466.  
  467.     EditsAtom                         edits;
  468.  
  469.     MediaDirectory                     media;
  470.  
  471.     UserDataAtom                     userData;                    /* space for extending with new data types */
  472. };
  473. typedef struct TrackDirectory TrackDirectory;
  474.  
  475. /*
  476. ***************************************
  477. *
  478. *   MovieDirectory -
  479. *        The MovieDirectory is the top level structure which
  480. *        holds the TrackInstance describing where the
  481. *        TrackDirectories are.
  482. *
  483. ***************************************
  484. */
  485. struct MovieHeader {
  486.     long                             flags;                        /* 1 byte of version / 3 bytes of flags */
  487.  
  488.     long                             creationTime;                /* seconds since Jan 1904 when directory was created */
  489.     long                             modificationTime;            /* seconds since Jan 1904 when directory was appended */
  490.  
  491.     TimeValue                         timeScale;                    /* Time specifications */
  492.     TimeValue                         duration;
  493.     Fixed                             preferredRate;                /* rate at which to play this movie */
  494.  
  495.     short                             preferredVolume;            /* volume to play movie at */
  496.     short                             reserved1;
  497.  
  498.     long                             preferredLong1;
  499.     long                             preferredLong2;
  500.  
  501.     MatrixRecord                     matrix;
  502.  
  503.     TimeValue                         previewTime;                /* time in track the proxy begins (track time) */
  504.     TimeValue                         previewDuration;            /* how long the proxy lasts (track time) */
  505.  
  506.     TimeValue                         posterTime;                    /* time in track the proxy begins (track time) */
  507.  
  508.     TimeValue                         selectionTime;                /* time in track the proxy begins (track time) */
  509.     TimeValue                         selectionDuration;            /* time in track the proxy begins (track time) */
  510.     TimeValue                         currentTime;                /* time in track the proxy begins (track time) */
  511.  
  512.     long                             nextTrackID;                /* next value to use for a TrackID */
  513. };
  514. typedef struct MovieHeader MovieHeader;
  515.  
  516. struct MovieHeaderAtom {
  517.     long                             size;
  518.     long                             atomType;                    /* = 'mvhd' */
  519.  
  520.     MovieHeader                     header;
  521. };
  522. typedef struct MovieHeaderAtom MovieHeaderAtom;
  523.  
  524. struct TrackDirectoryEntry {
  525.     TrackDirectory                     trackDirectory;                /* Track directory information */
  526. };
  527. typedef struct TrackDirectoryEntry TrackDirectoryEntry;
  528.  
  529. struct MovieDirectory {
  530.     long                             size;
  531.     long                             atomType;                    /* = 'moov' */
  532.  
  533.     MovieHeaderAtom                 header;
  534.  
  535.     ClippingAtom                     movieClip;
  536.  
  537.                                                                 /* Track Directories */
  538.     TrackDirectoryEntry             track[1];                    /* Track directory information */
  539.  
  540.                                                                 /* User data for Movie */
  541.     UserDataAtom                     userData;                    /* space for user extensions */
  542. };
  543. typedef struct MovieDirectory MovieDirectory;
  544.  
  545. /*
  546. ***************************************
  547. ***************************************
  548. */
  549. /* Movie formats and tags */
  550.  
  551. enum {
  552.                                                                 /* some system defined format IDs */
  553.     MOVIE_TYPE                    = 'moov',
  554.     TRACK_TYPE                    = 'trak',
  555.     MEDIA_TYPE                    = 'mdia',
  556.     VIDEO_TYPE                    = 'vide',
  557.     SOUND_TYPE                    = 'soun'
  558. };
  559.  
  560. /* atom id's */
  561.  
  562. enum {
  563.     MovieAID                    = 'moov',
  564.     MovieHeaderAID                = 'mvhd',
  565.     ClipAID                        = 'clip',
  566.     RgnClipAID                    = 'crgn',
  567.     MatteAID                    = 'matt',
  568.     MatteCompAID                = 'kmat',
  569.     TrackAID                    = 'trak',
  570.     UserDataAID                    = 'udta',
  571.     TrackHeaderAID                = 'tkhd',
  572.     EditsAID                    = 'edts',
  573.     EditListAID                    = 'elst',
  574.     MediaAID                    = 'mdia',
  575.     MediaHeaderAID                = 'mdhd',
  576.     MediaInfoAID                = 'minf',
  577.     VideoMediaInfoHeaderAID        = 'vmhd',
  578.     SoundMediaInfoHeaderAID        = 'smhd',
  579.     GenericMediaInfoHeaderAID    = 'gmhd',
  580.     GenericMediaInfoAID            = 'gmin',
  581.     DataInfoAID                    = 'dinf',
  582.     DataRefAID                    = 'dref',
  583.     SampleTableAID                = 'stbl',
  584.     STSampleDescAID                = 'stsd',
  585.     STTimeToSampAID                = 'stts',
  586.     STSyncSampleAID                = 'stss',
  587.     STSampleToChunkAID            = 'stsc',
  588.     STShadowSyncAID                = 'stsh',
  589.     HandlerAID                    = 'hdlr',
  590.     STSampleSizeAID                = 'stsz',
  591.     STChunkOffsetAID            = 'stco',
  592.     STChunkOffset64AID            = 'co64',
  593.     DataRefContainerAID            = 'drfc',
  594.     TrackReferenceAID            = 'tref',
  595.     ColorTableAID                = 'ctab',
  596.     LoadSettingsAID                = 'load',
  597.     PropertyAtomAID                = 'code',
  598.     InputMapAID                    = 'imap',
  599.     MovieBufferHintsAID            = 'mbfh',
  600.     MovieDataRefAliasAID        = 'mdra',
  601.     SoundLocalizationAID        = 'sloc'
  602. };
  603.  
  604. /* Text ATOM definitions*/
  605. struct TextBoxAtom {
  606.     long                             size;
  607.     long                             atomType;                    /* = 'tbox' */
  608.     Rect                             textBox;                    /* New text box (overrides defaultTextBox)*/
  609. };
  610. typedef struct TextBoxAtom TextBoxAtom;
  611.  
  612. struct HiliteAtom {
  613.     long                             size;
  614.     long                             atomType;                    /* = 'hlit' */
  615.     long                             selStart;                    /* hilite selection start character*/
  616.     long                             selEnd;                        /* hilite selection end character*/
  617. };
  618. typedef struct HiliteAtom HiliteAtom;
  619.  
  620. struct KaraokeRec {
  621.     TimeValue                         timeVal;
  622.     short                             beginHilite;
  623.     short                             endHilite;
  624. };
  625. typedef struct KaraokeRec KaraokeRec;
  626.  
  627. struct KaraokeAtom {
  628.     long                             numEntries;
  629.     KaraokeRec                         karaokeEntries[1];
  630. };
  631. typedef struct KaraokeAtom KaraokeAtom;
  632.  
  633.  
  634. #if PRAGMA_ALIGN_SUPPORTED
  635. #pragma options align=reset
  636. #endif
  637.  
  638. #if PRAGMA_IMPORT_SUPPORTED
  639. #pragma import off
  640. #endif
  641.  
  642. #ifdef __cplusplus
  643. }
  644. #endif
  645.  
  646. #endif /* __MOVIESFORMAT__ */
  647.  
  648.